//
//  RHSelectPlantCell.m
//  RuiHeAppApp
//
//  Created by bill on 2024/7/11.
//

#import "RHSelectPlantCell.h"
@interface RHSelectPlantCell()
@property (nonatomic ,strong) QMUILabel *plantNameLab;

@property (nonatomic ,strong) QMUILabel *tagLab;


@end
@implementation RHSelectPlantCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        [self setupUI];
    }
    return self;
}

-(void)setModel:(RHPlantModel *)model
{
    _model = model;
    self.plantNameLab.text = model.plantName;
    self.tagLab.hidden = !model.isSendCase;
    if (model.isSendCase) {
        if(model.checkStatus == 1){
            self.tagLab.text = @"已分享".rh_localized;
        }else if (model.checkStatus == 2){
            self.tagLab.text = @"未通过".rh_localized;
        }else if (model.checkStatus == 0){
            self.tagLab.text = @"审核中".rh_localized;
        }
    }
}

- (void)setupUI{
    
    [self setBackgroundColor:UIColor.clearColor];
    [self.contentView setBackgroundColor:UIColor.clearColor];
    
    
    UIView *bgView = [[UIView alloc] init];
    [bgView setBackgroundColor:UIColor.whiteColor];
   
    [self.contentView addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsZero);
    }];
    
    _arrowImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"agree"]];
    
    [bgView addSubview:_arrowImg];
    
    _plantNameLab = [[QMUILabel alloc] init];
    _plantNameLab.numberOfLines = 2;
    [_plantNameLab setFont:[UIFont boldSystemFontOfSize:14]];
    [_plantNameLab setTextColor:kCOLOR_HEX(@"#3F4443")];
    [bgView addSubview:_plantNameLab];
    
    _tagLab = [[QMUILabel alloc] init];
    [_tagLab setFont:[UIFont systemFontOfSize:12]];
    _tagLab.text = @"已有发布视频".rh_localized;
    [_tagLab setTextColor:[kCOLOR_HEX(@"#3F4443") colorWithAlphaComponent:0.4]];
    [bgView addSubview:_tagLab];
    
    kWeakSelf;
    _line = kView;
    _line.backgroundColor = kCOLOR_HEX(@"#EBEDF0");
    [bgView addSubview:_line];
    [_line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.plantNameLab);
        make.right.equalTo(weakSelf.arrowImg);
        make.bottom.mas_offset(0);
        make.height.offset(1);
    }];
    

    [_arrowImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(18, 18));
        make.right.mas_offset(-15);
        make.centerY.mas_offset(0);
    }];
    
    [_plantNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.right.equalTo(weakSelf.tagLab.mas_left).offset(-5);
        make.centerY.mas_offset(0);
        make.top.mas_offset(15);
        make.bottom.mas_offset(-15);
    }];
    
    [_tagLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15);
        make.centerY.mas_offset(0);
    }];
    
    
}
@end
